<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>赞助列表 | SocialHub</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <style>
        :root {
            --primary: #4361ee;
            --primary-light: #eef0ff;
            --primary-dark: #3a0ca3;
            --secondary: #f72585;
            --accent: #4cc9f0;
            --light: #f8f9fa;
            --dark: #212529;
            --gray: #6c757d;
            --light-gray: #e9ecef;
            --success: #38b000;
            --warning: #ffaa00;
        }
        
        body {
            font-family: 'Inter', system-ui, -apple-system, sans-serif;
            background-color: #f5f7ff;
            color: var(--dark);
            line-height: 1.6;
        }
        
        .navbar {
            background-color: white;
            box-shadow: 0 2px 15px rgba(0,0,0,0.05);
            padding: 0.75rem 1rem;
        }
        
        .logo {
            font-size: 1.5rem;
            font-weight: 700;
            color: var(--primary);
            text-decoration: none;
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }
        
        .search-container {
            max-width: 500px;
            width: 100%;
        }
        
        .main-container {
            padding: 1.5rem 0;
        }
        
        .section-title {
            font-size: 1.75rem;
            font-weight: 700;
            margin-bottom: 1.5rem;
            color: var(--primary-dark);
        }
        
        .filter-section {
            background-color: white;
            border-radius: 10px;
            box-shadow: 0 2px 10px rgba(0,0,0,0.05);
            padding: 1.25rem;
            margin-bottom: 1.5rem;
        }
        
        .filter-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 1rem;
        }
        
        .filter-title {
            font-weight: 600;
            font-size: 1.1rem;
        }
        
        .filter-toggle {
            color: var(--primary);
            background: none;
            border: none;
            font-size: 0.9rem;
            display: flex;
            align-items: center;
            gap: 0.25rem;
            cursor: pointer;
        }
        
        .filter-group {
            margin-bottom: 1.25rem;
        }
        
        .filter-label {
            font-weight: 600;
            margin-bottom: 0.75rem;
            display: block;
        }
        
        .filter-options {
            display: flex;
            flex-wrap: wrap;
            gap: 0.75rem;
        }
        
        .filter-chip {
            background-color: var(--light);
            border: 1px solid var(--light-gray);
            border-radius: 20px;
            padding: 0.35rem 1rem;
            font-size: 0.9rem;
            cursor: pointer;
            transition: all 0.2s;
        }
        
        .filter-chip:hover {
            background-color: var(--primary-light);
            border-color: var(--primary);
            color: var(--primary);
        }
        
        .filter-chip.active {
            background-color: var(--primary);
            color: white;
            border-color: var(--primary);
        }
        
        .range-slider {
            width: 100%;
            margin: 1rem 0;
        }
        
        .range-values {
            display: flex;
            justify-content: space-between;
            color: var(--gray);
            font-size: 0.9rem;
        }
        
        .view-controls {
            display: flex;
            align-items: center;
            gap: 1rem;
            margin-bottom: 1.5rem;
        }
        
        .view-btn {
            background: none;
            border: 1px solid var(--light-gray);
            border-radius: 6px;
            padding: 0.5rem;
            cursor: pointer;
            color: var(--gray);
            transition: all 0.2s;
        }
        
        .view-btn.active {
            background-color: var(--primary);
            color: white;
            border-color: var(--primary);
        }
        
        .sort-control {
            margin-left: auto;
        }
        
        .form-select {
            border-radius: 6px;
            border-color: var(--light-gray);
        }
        
        .form-select:focus {
            border-color: var(--primary);
            box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.1);
        }
        
        .sponsorship-card {
            background-color: white;
            border-radius: 10px;
            box-shadow: 0 2px 10px rgba(0,0,0,0.05);
            overflow: hidden;
            margin-bottom: 1.5rem;
            transition: transform 0.2s, box-shadow 0.2s;
            border: none;
        }
        
        .sponsorship-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 10px 20px rgba(0,0,0,0.1);
        }
        
        .card-header {
            padding: 1rem 1.25rem;
            border-bottom: 1px solid var(--light-gray);
            background-color: white;
        }
        
        .card-body {
            padding: 1.25rem;
        }
        
        .card-footer {
            padding: 1rem 1.25rem;
            border-top: 1px solid var(--light-gray);
            background-color: white;
        }
        
        /* 作者信息样式 */
        .author-info {
            display: flex;
            align-items: center;
            gap: 0.75rem;
        }
        
        .author-avatar {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            object-fit: cover;
        }
        
        .author-name {
            font-weight: 600;
            font-size: 1rem;
        }
        
        .post-time {
            color: var(--gray);
            font-size: 0.85rem;
        }
        
        /* 图片容器样式 */
        .image-container {
            position: relative;
            margin-bottom: 1rem;
        }
        
        .single-image {
            width: 100%;
            height: 200px;
            object-fit: cover;
            border-radius: 8px;
        }
        
        .multi-image {
            display: grid;
            grid-template-columns: repeat(2, 1fr);
            gap: 0.5rem;
            border-radius: 8px;
            overflow: hidden;
        }
        
        .multi-image img {
            width: 100%;
            height: 100px;
            object-fit: cover;
        }
        
        .no-image {
            background-color: var(--light-gray);
            height: 160px;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 8px;
            color: var(--gray);
        }
        
        /* 标题和描述样式 */
        .sponsorship-title {
            font-size: 1.25rem;
            font-weight: 600;
            margin-bottom: 0.5rem;
            color: var(--dark);
            line-height: 1.4;
        }
        
        .sponsorship-desc {
            color: var(--gray);
            font-size: 0.95rem;
            margin-bottom: 1rem;
            display: -webkit-box;
            -webkit-line-clamp: 2;
            -webkit-box-orient: vertical;
            overflow: hidden;
        }
        
        /* 标签样式 */
        .tags {
            display: flex;
            flex-wrap: wrap;
            gap: 0.5rem;
            margin-bottom: 1rem;
        }
        
        .tag {
            background-color: var(--primary-light);
            color: var(--primary);
            padding: 0.25rem 0.75rem;
            border-radius: 20px;
            font-size: 0.85rem;
            text-decoration: none;
        }
        
        /* 统计信息样式 */
        .stats {
            display: flex;
            align-items: center;
            gap: 1.25rem;
            color: var(--gray);
            font-size: 0.9rem;
        }
        
        .stat-item {
            display: flex;
            align-items: center;
            gap: 0.35rem;
        }
        
        /* 操作按钮样式 */
        .actions {
            display: flex;
            align-items: center;
            gap: 0.75rem;
        }
        
        .action-btn {
            background: none;
            border: none;
            color: var(--gray);
            padding: 0.5rem;
            border-radius: 6px;
            cursor: pointer;
            transition: all 0.2s;
            display: flex;
            align-items: center;
            gap: 0.25rem;
            font-size: 0.9rem;
        }
        
        .action-btn:hover {
            background-color: var(--primary-light);
            color: var(--primary);
        }
        
        .action-btn.liked {
            color: var(--secondary);
        }
        
        .action-btn.saved {
            color: var(--primary);
        }
        
        /* 布局特定样式 */
        .list-view .sponsorship-card {
            display: flex;
            height: 100%;
        }
        
        .list-view .image-container {
            flex: 0 0 200px;
            margin-bottom: 0;
            margin-right: 1rem;
        }
        
        .list-view .single-image {
            height: 100%;
        }
        
        .list-view .multi-image img {
            height: 100%;
        }
        
        .list-view .content {
            flex: 1;
            display: flex;
            flex-direction: column;
        }
        
        .list-view .card-footer {
            margin-top: auto;
        }
        
        .grid-view {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
            gap: 1.5rem;
        }
        
        .featured-badge {
            position: absolute;
            top: 10px;
            right: 10px;
            background-color: var(--secondary);
            color: white;
            padding: 0.25rem 0.75rem;
            border-radius: 20px;
            font-size: 0.8rem;
            font-weight: 600;
            z-index: 1;
        }
        
        .filter-results {
            display: flex;
            align-items: center;
            margin-bottom: 1rem;
            color: var(--gray);
            font-size: 0.95rem;
        }
        
        .active-filters {
            display: flex;
            flex-wrap: wrap;
            gap: 0.75rem;
            margin-bottom: 1.5rem;
        }
        
        .active-filter {
            background-color: var(--primary-light);
            color: var(--primary);
            padding: 0.35rem 0.75rem;
            border-radius: 20px;
            font-size: 0.9rem;
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }
        
        .remove-filter {
            background: none;
            border: none;
            color: var(--primary);
            cursor: pointer;
            font-size: 1rem;
            line-height: 1;
        }
        
        .clear-all {
            color: var(--primary);
            background: none;
            border: none;
            font-size: 0.9rem;
            cursor: pointer;
            margin-left: auto;
        }
        
        .load-more {
            text-align: center;
            margin: 2rem 0;
        }
        
        .load-more-btn {
            background-color: white;
            border: 1px solid var(--light-gray);
            border-radius: 6px;
            padding: 0.75rem 2rem;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s;
            display: flex;
            align-items: center;
            gap: 0.5rem;
            margin: 0 auto;
        }
        
        .load-more-btn:hover {
            background-color: var(--primary);
            color: white;
            border-color: var(--primary);
        }
        
        @media (max-width: 768px) {
            .search-container {
                order: 3;
                margin-top: 1rem;
                width: 100%;
                max-width: none;
            }
            
            .navbar-nav {
                margin-top: 1rem;
            }
            
            .list-view .sponsorship-card {
                flex-direction: column;
            }
            
            .list-view .image-container {
                flex: none;
                width: 100%;
                margin-right: 0;
                margin-bottom: 1rem;
            }
            
            .list-view .single-image {
                height: 180px;
            }
            
            .section-title {
                font-size: 1.5rem;
            }
            
            .filter-section {
                padding: 1rem;
            }
            
            .view-controls {
                flex-wrap: wrap;
            }
            
            .sort-control {
                margin-left: 0;
                width: 100%;
                margin-top: 0.5rem;
            }
        }
    </style>
</head>
<body>
    <!-- 导航栏 -->
    <nav class="navbar navbar-expand-lg">
        <div class="container">
            <a href="#" class="logo">
                <i class="fas fa-handshake"></i>
                SocialHub
            </a>
            
            <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav">
                <span class="navbar-toggler-icon"></span>
            </button>
            
            <div class="search-container mx-3">
                <div class="input-group">
                    <span class="input-group-text bg-transparent border-right-0">
                        <i class="fas fa-search text-gray-400"></i>
                    </span>
                    <input type="text" class="form-control border-left-0" placeholder="搜索赞助项目、标签或关键词...">
                </div>
            </div>
            
            <div class="collapse navbar-collapse" id="navbarNav">
                <ul class="navbar-nav ms-auto align-items-center gap-3">
                    <li class="nav-item">
                        <a href="#" class="nav-link active">赞助列表</a>
                    </li>
                    <li class="nav-item">
                        <a href="#" class="nav-link">发现</a>
                    </li>
                    <li class="nav-item">
                        <button class="btn btn-primary">
                            <i class="fas fa-plus me-1"></i> 发起赞助
                        </button>
                    </li>
                    <li class="nav-item">
                        <img src="https://picsum.photos/100/100?random=1" alt="用户头像" class="rounded-circle" style="width: 38px; height: 38px; object-fit: cover;">
                    </li>
                </ul>
            </div>
        </div>
    </nav>
    
    <div class="container main-container">
        <h2 class="section-title">赞助项目</h2>
        
        <!-- 筛选区域 -->
        <div class="filter-section">
            <div class="filter-header">
                <div class="filter-title">筛选条件</div>
                <button class="filter-toggle" id="toggleFilters">
                    <i class="fas fa-chevron-up"></i>
                    <span>收起筛选</span>
                </button>
            </div>
            
            <div class="filter-content" id="filterContent">
                <!-- 分类筛选 -->
                <div class="filter-group">
                    <div class="filter-label">项目分类</div>
                    <div class="filter-options">
                        <div class="filter-chip active">全部</div>
                        <div class="filter-chip">环保公益</div>
                        <div class="filter-chip">教育支持</div>
                        <div class="filter-chip">医疗健康</div>
                        <div class="filter-chip">文化艺术</div>
                        <div class="filter-chip">动物保护</div>
                        <div class="filter-chip">创业扶持</div>
                        <div class="filter-chip">紧急救助</div>
                    </div>
                </div>
                
                <!-- 金额范围筛选 -->
                <div class="filter-group">
                    <div class="filter-label">所需金额范围</div>
                    <input type="range" min="0" max="10000" value="5000" class="range-slider" id="amountRange">
                    <div class="range-values">
                        <span>¥0</span>
                        <span id="rangeValue">¥5,000+</span>
                        <span>¥10,000+</span>
                    </div>
                </div>
                
                <!-- 发布时间筛选 -->
                <div class="filter-group">
                    <div class="filter-label">发布时间</div>
                    <div class="filter-options">
                        <div class="filter-chip active">不限</div>
                        <div class="filter-chip">今天</div>
                        <div class="filter-chip">本周</div>
                        <div class="filter-chip">本月</div>
                        <div class="filter-chip">近3个月</div>
                    </div>
                </div>
                
                <!-- 热门程度筛选 -->
                <div class="filter-group">
                    <div class="filter-label">热门程度</div>
                    <div class="filter-options">
                        <div class="filter-chip active">不限</div>
                        <div class="filter-chip">关注度高</div>
                        <div class="filter-chip">最新发布</div>
                        <div class="filter-chip">即将结束</div>
                        <div class="filter-chip">赞助人数多</div>
                    </div>
                </div>
                
                <!-- 位置筛选 -->
                <div class="filter-group">
                    <div class="filter-label">位置范围</div>
                    <div class="filter-options">
                        <div class="filter-chip active">全国</div>
                        <div class="filter-chip">同城</div>
                        <div class="filter-chip">本省</div>
                        <div class="filter-chip">100公里内</div>
                        <div class="filter-chip">500公里内</div>
                    </div>
                </div>
            </div>
        </div>
        
        <!-- 活跃筛选标签和视图控制 -->
        <div class="active-filters">
            <div class="active-filter">
                项目分类: 全部
                <button class="remove-filter"><i class="fas fa-times"></i></button>
            </div>
            <div class="active-filter">
                金额范围: 0 - 5,000元
                <button class="remove-filter"><i class="fas fa-times"></i></button>
            </div>
            <div class="active-filter">
                发布时间: 不限
                <button class="remove-filter"><i class="fas fa-times"></i></button>
            </div>
            <button class="clear-all">清除全部筛选</button>
        </div>
        
        <div class="filter-results">
            找到 <strong>246</strong> 个符合条件的赞助项目
        </div>
        
        <!-- 视图控制和排序 -->
        <div class="view-controls">
            <button class="view-btn active" id="gridViewBtn" title="网格视图">
                <i class="fas fa-th"></i>
            </button>
            <button class="view-btn" id="listViewBtn" title="列表视图">
                <i class="fas fa-list"></i>
            </button>
            
            <div class="sort-control">
                <select class="form-select" id="sortSelect">
                    <option value="recommended">推荐排序</option>
                    <option value="newest">最新发布</option>
                    <option value="mostPopular">最受欢迎</option>
                    <option value="endingSoon">即将结束</option>
                    <option value="amountLow">金额从低到高</option>
                    <option value="amountHigh">金额从高到低</option>
                </select>
            </div>
        </div>
        
        <!-- 赞助列表内容 - 默认网格视图 -->
        <div class="sponsorships-container grid-view" id="sponsorshipsContainer">
            <!-- 赞助项目1 -->
            <div class="sponsorship-card">
                <div class="card-header">
                    <div class="author-info">
                        <img src="https://picsum.photos/100/100?random=10" alt="环保协会头像" class="author-avatar">
                        <div>
                            <div class="author-name">绿色未来环保协会</div>
                            <div class="post-time">发布于 3天前</div>
                        </div>
                    </div>
                </div>
                
                <div class="card-body">
                    <div class="image-container">
                        <span class="featured-badge">精选</span>
                        <img src="https://picsum.photos/400/300?random=20" alt="海洋清洁项目" class="single-image">
                    </div>
                    
                    <h3 class="sponsorship-title">海洋塑料垃圾清理计划 - 保护蓝色家园</h3>
                    
                    <p class="sponsorship-desc">我们计划组织志愿者团队进行沿海地区塑料垃圾清理，并开展环保教育活动，提高公众对海洋污染的认识。</p>
                    
                    <div class="tags">
                        <span class="tag">环保</span>
                        <span class="tag">海洋保护</span>
                        <span class="tag">志愿者</span>
                    </div>
                </div>
                
                <div class="card-footer d-flex justify-content-between align-items-center">
                    <div class="stats">
                        <div class="stat-item">
                            <i class="fas fa-eye"></i>
                            <span>2.5k</span>
                        </div>
                        <div class="stat-item">
                            <i class="fas fa-comment"></i>
                            <span>128</span>
                        </div>
                    </div>
                    
                    <div class="actions">
                        <button class="action-btn like-btn" data-id="1">
                            <i class="far fa-heart"></i>
                            <span>342</span>
                        </button>
                        <button class="action-btn save-btn" data-id="1">
                            <i class="far fa-bookmark"></i>
                        </button>
                        <button class="btn btn-primary btn-sm">
                            赞助
                        </button>
                    </div>
                </div>
            </div>
            
            <!-- 赞助项目2 -->
            <div class="sponsorship-card">
                <div class="card-header">
                    <div class="author-info">
                        <img src="https://picsum.photos/100/100?random=11" alt="公益读书社头像" class="author-avatar">
                        <div>
                            <div class="author-name">公益读书社</div>
                            <div class="post-time">发布于 1周前</div>
                        </div>
                    </div>
                </div>
                
                <div class="card-body">
                    <div class="image-container">
                        <div class="multi-image">
                            <img src="https://picsum.photos/400/300?random=30" alt="乡村图书馆项目图片1">
                            <img src="https://picsum.photos/400/300?random=31" alt="乡村图书馆项目图片2">
                        </div>
                    </div>
                    
                    <h3 class="sponsorship-title">乡村图书馆建设 - 知识改变命运</h3>
                    
                    <p class="sponsorship-desc">为偏远山区乡村小学建立图书馆，提供适合儿童阅读的书籍，培养阅读习惯，拓宽孩子们的视野。</p>
                    
                    <div class="tags">
                        <span class="tag">教育</span>
                        <span class="tag">乡村</span>
                        <span class="tag">图书馆</span>
                    </div>
                </div>
                
                <div class="card-footer d-flex justify-content-between align-items-center">
                    <div class="stats">
                        <div class="stat-item">
                            <i class="fas fa-eye"></i>
                            <span>1.8k</span>
                        </div>
                        <div class="stat-item">
                            <i class="fas fa-comment"></i>
                            <span>95</span>
                        </div>
                    </div>
                    
                    <div class="actions">
                        <button class="action-btn like-btn" data-id="2">
                            <i class="fas fa-heart liked"></i>
                            <span>287</span>
                        </button>
                        <button class="action-btn save-btn" data-id="2">
                            <i class="far fa-bookmark"></i>
                        </button>
                        <button class="btn btn-primary btn-sm">
                            赞助
                        </button>
                    </div>
                </div>
            </div>
            
            <!-- 赞助项目3 -->
            <div class="sponsorship-card">
                <div class="card-header">
                    <div class="author-info">
                        <img src="https://picsum.photos/100/100?random=12" alt="爱心动物保护协会头像" class="author-avatar">
                        <div>
                            <div class="author-name">爱心动物保护协会</div>
                            <div class="post-time">发布于 5天前</div>
                        </div>
                    </div>
                </div>
                
                <div class="card-body">
                    <div class="image-container">
                        <img src="https://picsum.photos/400/300?random=40" alt="流浪动物救助项目" class="single-image">
                    </div>
                    
                    <h3 class="sponsorship-title">流浪动物救助与安置计划</h3>
                    
                    <p class="sponsorship-desc">为城市流浪动物提供临时收容、医疗救助和绝育服务，并努力为它们寻找永久的家。</p>
                    
                    <div class="tags">
                        <span class="tag">动物保护</span>
                        <span class="tag">救助</span>
                        <span class="tag">公益</span>
                    </div>
                </div>
                
                <div class="card-footer d-flex justify-content-between align-items-center">
                    <div class="stats">
                        <div class="stat-item">
                            <i class="fas fa-eye"></i>
                            <span>1.5k</span>
                        </div>
                        <div class="stat-item">
                            <i class="fas fa-comment"></i>
                            <span>78</span>
                        </div>
                    </div>
                    
                    <div class="actions">
                        <button class="action-btn like-btn" data-id="3">
                            <i class="far fa-heart"></i>
                            <span>215</span>
                        </button>
                        <button class="action-btn save-btn" data-id="3">
                            <i class="fas fa-bookmark saved"></i>
                        </button>
                        <button class="btn btn-primary btn-sm">
                            赞助
                        </button>
                    </div>
                </div>
            </div>
            
            <!-- 赞助项目4 (无图) -->
            <div class="sponsorship-card">
                <div class="card-header">
                    <div class="author-info">
                        <img src="https://picsum.photos/100/100?random=13" alt="大学生创业团队头像" class="author-avatar">
                        <div>
                            <div class="author-name">大学生创业团队</div>
                            <div class="post-time">发布于 2天前</div>
                        </div>
                    </div>
                </div>
                
                <div class="card-body">
                    <div class="image-container">
                        <div class="no-image">
                            <i class="fas fa-lightbulb fa-2x"></i>
                        </div>
                    </div>
                    
                    <h3 class="sponsorship-title">校园创新创业大赛 - 项目孵化支持</h3>
                    
                    <p class="sponsorship-desc">支持大学生创新创业项目，提供启动资金和导师指导，帮助有潜力的项目实现商业化转型。</p>
                    
                    <div class="tags">
                        <span class="tag">创业</span>
                        <span class="tag">教育</span>
                        <span class="tag">青年</span>
                    </div>
                </div>
                
                <div class="card-footer d-flex justify-content-between align-items-center">
                    <div class="stats">
                        <div class="stat-item">
                            <i class="fas fa-eye"></i>
                            <span>980</span>
                        </div>
                        <div class="stat-item">
                            <i class="fas fa-comment"></i>
                            <span>42</span>
                        </div>
                    </div>
                    
                    <div class="actions">
                        <button class="action-btn like-btn" data-id="4">
                            <i class="far fa-heart"></i>
                            <span>136</span>
                        </button>
                        <button class="action-btn save-btn" data-id="4">
                            <i class="far fa-bookmark"></i>
                        </button>
                        <button class="btn btn-primary btn-sm">
                            赞助
                        </button>
                    </div>
                </div>
            </div>
        </div>
        
        <!-- 加载更多 -->
        <div class="load-more">
            <button class="load-more-btn">
                <i class="fas fa-spinner"></i>
                加载更多赞助项目
            </button>
        </div>
    </div>
    
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
    <script>
        document.addEventListener('DOMContentLoaded', function() {
            // 筛选条件折叠/展开功能
            const toggleFiltersBtn = document.getElementById('toggleFilters');
            const filterContent = document.getElementById('filterContent');
            let filtersExpanded = true;
            
            toggleFiltersBtn.addEventListener('click', function() {
                filtersExpanded = !filtersExpanded;
                
                if (filtersExpanded) {
                    filterContent.style.display = 'block';
                    this.innerHTML = '<i class="fas fa-chevron-up"></i><span>收起筛选</span>';
                } else {
                    filterContent.style.display = 'none';
                    this.innerHTML = '<i class="fas fa-chevron-down"></i><span>展开筛选</span>';
                }
            });
            
            // 金额范围滑块
            const amountRange = document.getElementById('amountRange');
            const rangeValue = document.getElementById('rangeValue');
            
            amountRange.addEventListener('input', function() {
                const value = parseInt(this.value);
                let displayValue;
                
                if (value === 0) {
                    displayValue = '¥0';
                } else if (value === 10000) {
                    displayValue = '¥10,000+';
                } else {
                    displayValue = `¥${value.toLocaleString()}+`;
                }
                
                rangeValue.textContent = displayValue;
                
                // 更新活跃筛选标签
                document.querySelectorAll('.active-filter')[1].innerHTML = 
                    `金额范围: 0 - ${displayValue}
                    <button class="remove-filter"><i class="fas fa-times"></i></button>`;
            });
            
            // 筛选标签点击事件
            const filterChips = document.querySelectorAll('.filter-chip');
            
            filterChips.forEach(chip => {
                chip.addEventListener('click', function() {
                    // 找到同一组中的其他标签并移除active类
                    const parentGroup = this.closest('.filter-options');
                    parentGroup.querySelectorAll('.filter-chip').forEach(c => {
                        c.classList.remove('active');
                    });
                    
                    // 为当前点击的标签添加active类
                    this.classList.add('active');
                    
                    // 更新活跃筛选标签显示（实际应用中需要根据筛选组更新对应的标签）
                    // 这里仅作示例
                });
            });
            
            // 移除单个筛选条件
            const removeFilterBtns = document.querySelectorAll('.remove-filter');
            
            removeFilterBtns.forEach(btn => {
                btn.addEventListener('click', function() {
                    this.closest('.active-filter').remove();
                    
                    // 重置对应的筛选条件（实际应用中需要实现）
                });
            });
            
            // 清除全部筛选条件
            const clearAllBtn = document.querySelector('.clear-all');
            
            clearAllBtn.addEventListener('click', function() {
                // 重置所有筛选标签为默认状态
                document.querySelectorAll('.filter-chip').forEach(chip => {
                    if (chip.textContent === '全部' || chip.textContent === '不限') {
                        chip.classList.add('active');
                    } else {
                        chip.classList.remove('active');
                    }
                });
                
                // 重置金额滑块
                amountRange.value = 5000;
                rangeValue.textContent = '¥5,000+';
                
                // 重新设置活跃筛选标签
                const activeFiltersContainer = document.querySelector('.active-filters');
                activeFiltersContainer.innerHTML = `
                    <div class="active-filter">
                        项目分类: 全部
                        <button class="remove-filter"><i class="fas fa-times"></i></button>
                    </div>
                    <div class="active-filter">
                        金额范围: 0 - 5,000元
                        <button class="remove-filter"><i class="fas fa-times"></i></button>
                    </div>
                    <div class="active-filter">
                        发布时间: 不限
                        <button class="remove-filter"><i class="fas fa-times"></i></button>
                    </div>
                    <button class="clear-all">清除全部筛选</button>
                `;
                
                // 重新绑定事件
                bindFilterEvents();
            });
            
            // 视图切换功能
            const gridViewBtn = document.getElementById('gridViewBtn');
            const listViewBtn = document.getElementById('listViewBtn');
            const sponsorshipsContainer = document.getElementById('sponsorshipsContainer');
            
            gridViewBtn.addEventListener('click', function() {
                sponsorshipsContainer.classList.remove('list-view');
                sponsorshipsContainer.classList.add('grid-view');
                gridViewBtn.classList.add('active');
                listViewBtn.classList.remove('active');
            });
            
            listViewBtn.addEventListener('click', function() {
                sponsorshipsContainer.classList.remove('grid-view');
                sponsorshipsContainer.classList.add('list-view');
                listViewBtn.classList.add('active');
                gridViewBtn.classList.remove('active');
            });
            
            // 排序功能
            const sortSelect = document.getElementById('sortSelect');
            
            sortSelect.addEventListener('change', function() {
                const selectedValue = this.value;
                // 在实际应用中，这里会根据选择的排序方式重新加载或排序赞助项目
                console.log('排序方式: ' + selectedValue);
            });
            
            // 点赞功能
            const likeBtns = document.querySelectorAll('.like-btn');
            
            likeBtns.forEach(btn => {
                btn.addEventListener('click', function() {
                    this.classList.toggle('liked');
                    const icon = this.querySelector('i');
                    const count = this.querySelector('span');
                    let currentCount = parseInt(count.textContent);
                    
                    if (this.classList.contains('liked')) {
                        icon.classList.remove('far');
                        icon.classList.add('fas');
                        count.textContent = currentCount + 1;
                    } else {
                        icon.classList.remove('fas');
                        icon.classList.add('far');
                        count.textContent = currentCount - 1;
                    }
                });
            });
            
            // 收藏功能
            const saveBtns = document.querySelectorAll('.save-btn');
            
            saveBtns.forEach(btn => {
                btn.addEventListener('click', function() {
                    this.classList.toggle('saved');
                    const icon = this.querySelector('i');
                    
                    if (this.classList.contains('saved')) {
                        icon.classList.remove('far');
                        icon.classList.add('fas');
                    } else {
                        icon.classList.remove('fas');
                        icon.classList.add('far');
                    }
                });
            });
            
            // 加载更多按钮
            const loadMoreBtn = document.querySelector('.load-more-btn');
            
            loadMoreBtn.addEventListener('click', function() {
                this.innerHTML = '<i class="fas fa-spinner fa-spin"></i> 加载中...';
                
                // 模拟加载延迟
                setTimeout(() => {
                    this.innerHTML = '<i class="fas fa-spinner"></i> 加载更多赞助项目';
                    // 在实际应用中，这里会加载并添加更多赞助项目
                }, 1500);
            });
            
            // 绑定筛选相关事件的辅助函数
            function bindFilterEvents() {
                // 重新绑定移除筛选事件
                document.querySelectorAll('.remove-filter').forEach(btn => {
                    btn.addEventListener('click', function() {
                        this.closest('.active-filter').remove();
                    });
                });
                
                // 重新绑定清除全部事件
                document.querySelector('.clear-all').addEventListener('click', clearAllBtn.click.bind(clearAllBtn));
            }
        });
    </script>
</body>
</html>
    
